
<form id="pagerForm" method="post" action="{:U($module_name.'/'.$action_name)}" onsubmit="return divSearch(this, 'CatBox');">
	<input type="hidden" name="pageNum" value="{$pageNum}" />
	<input type="hidden" name="numPerPage" value="{$numPerPage}" />
	<input type="hidden" name="orderField" value="{$orderField}" />
	<input type="hidden" name="orderDirection" value="{$orderDirection}" />
	<input type="hidden" name="keywords" value="{$keywords}" />
	<input type="hidden" name="sfield" value="{$sfield}" />
	<input type="hidden" name="cid" value="{$catid}" />
	<input type="hidden" name="status" value="{$status}" />
</form>

<div class="pageHeader">
	<form  rel="pagerForm" onsubmit="return divSearch(this, 'catBox');" action="{:U($module_name.'/'.$action_name)}" method="post">
		<input type="hidden" name="m" value="{$module_name}" />
		<input type="hidden" name="a" value="{$action_name}" />
		<input type="hidden" name="cid" value="{$catid}" />
	<div class="searchBar">
		<ul class="searchContent">
			<li style="width:210px;">
				<label style="width:60px;">关键字：</label>
                <input type="text" name="keywords" value="{$keywords}" style="width: 120px;"/>
				<input type="hidden" name="sfield_name" value="userid,username,aid" />	
				<!--<input type="text" class="autoinput" name="keywords.keywords" value="{$keywords}" style="width:120px;" postField="keywords" suggestFields="id,keywords" suggestUrl="{:U('Content/suggest',array('tn'=>'ProductCat','fn'=>'id,keywords','field'=>'p.id,pd.name','where'=>myencode(array('category_tag_id'=>$catid),1)))}" lookupGroup="keywords"/>-->
			</li>
			<li style="width:60px;">
			<select name="sfield" class="combox">
				<option value="all" {if $wherefields=='all'}selected="selected"{/if}>全部</option>
				<option value="name" {if $wherefields=='name'}selected="selected"{/if}>分类名称</option>
			</select>
			<input type="hidden" name="sfield_name" value="name" />
			<input type='hidden' name='cid' value='{$cid}' />
			</li>
	
			<div class="buttonActive"><div class="buttonContent"><button type="submit">检索</button></div></div>
		</ul>
	</div>
	</form>
</div>

<div class="pageContent">
			<div class="panelBar">
						<ul class="toolBar">
							<li><a class="add" href="{:U($module_name.'/add')}&cid={$cid}" target="dialog" width="580" height="350" ><span>添加分类</span></a></li>
							<li><a class="edit" href="{:U($module_name.'/edit')}&id={sid_dv}"  target="dialog" width="580" height="350"  warn="请选择一条信息"><span>修改分类信息</span></a></li>
							<li class="line">line</li>
							<li><a title="分类下面有产品，产品将会被删掉，如果不想被删除，请先修改产品分类！ 确实要删除这些记录吗?" target="selectedTodo" rel="ids[]" href="{:U($module_name.'/delall')}" class="delete"><span>批量删除</span></a></li>
							<li><a title="分类下面所有子类及子类的子类都会被删除，请慎重操作?" target="selectedTodo" rel="ids[]" href="{:U($module_name.'/del_tree')}" class="delete"><span>删除分类树</span></a></li>
						</ul>
			</div>
			
				<table class="list" width="98%" rel="catBox" layoutH="100">
						<thead>
							<tr>
								<th width="22"><input type="checkbox" group="ids[]" class="checkboxCtrl"></th>
								<th width="60" orderField="id" {if $orderField=='id'}class="{$orderDirection}"{/if}>编号</th>
								<th width="200" orderField="name" {if $orderField=='name'}class="{$orderDirection}"{/if}>名称</th>														
								<!--<th width="200" orderField="parent_id" {if $orderField=='parent_id'}class="{$orderDirection}"{/if}>上级分类</th>-->
								<th width="150" orderField="write_date" {if $orderField=='write_date'}class="{$orderDirection}"{/if}>类型</th>
								<th width="120">操作</th>
							</tr>
						</thead>
						<tbody>
				<volist name="list" id="vo">
							<tr target="sid_dv" {if $vo['id']!=1}rel="{$vo['id']}"{/if}>
								<td><input name="ids[]" value="{$vo['id']}" type="checkbox"></td>
								<td>{$vo['id']}</td>
								<td>{$vo['name']}</td>
								<!--
								<td>{if $vo['parent_id']==0}-{else}{$cats[$vo['parent_id']]['name']}{/if}</td>
								-->
								<td>{if $vo['type']== 1}分类{/if}</td>
								<td>
{if $vo['id']==1}
									<a href="{:U($module_name.'/add',array('pid'=>$vo['id']))}" target="dialog" width="580" height="350" rel="{$module_name}_add" class="btnAdd">添加子分类</a>
{else}
									<a title="分类下面有产品，产品将会被删掉，如果不想被删除，请先修改产品分类！ 确实要删除这些记录吗?" target="ajaxTodo" href="{:U($module_name.'/delall',array('id'=>$vo['id'],'pid'=>$cid))}"  >删除</a>
									<a title="编辑" target="dialog" width="580" height="350"  rel="{$module_name}_edit_{$vo['id']}" href="{:U($module_name.'/edit',array('id'=>$vo['id'],'pid'=>$pid))}" class="btnEdit">编辑</a>
									<a href="{:U($module_name.'/add',array('pid'=>$vo['id']))}" target="dialog" width="580" height="350" rel="{$module_name}_add" class="add">添加子分类</a>								
{/if}
								</td>
							</tr>
				</volist>
						</tbody>
		</table>
		
					
<div class="panelBar">
	<div class="pages">
		<span>显示</span>
		<select class="combox" name="numPerPage" onchange="navTabPageBreak({numPerPage:this.value},'catBox')">
			<option value="20" {if $numPerPage==20}selected="selected"{/if}>20</option>
			<option value="50" {if $numPerPage==50}selected="selected"{/if}>50</option>
			<option value="66" {if $numPerPage==66}selected="selected"{/if}>66</option>
			<option value="100" {if $numPerPage==100}selected="selected"{/if}>100</option>
			<option value="200" {if $numPerPage==200}selected="selected"{/if}>200</option>
			<option value="500" {if $numPerPage==500}selected="selected"{/if}>500</option>
		</select>
		<span>条，共{$totalCount}条</span>
	</div>
	
	<div class="pagination" targetType="navTab" rel="catBox" totalCount="{$totalCount}" numPerPage="{$numPerPage}" pageNumShown="10" currentPage="{$pageNum}"></div>
</div>
</div>
<script>
function ajaxTodo(url){
	$.ajax({
		type: 'POST',
		url: url,
		dataType: "json",
		cache: false,
		success: function(){ $("a", $(".j-num")).parent('.selected').children().click(); },
		error: DWZ.ajaxError
	});
}
</script>
